#sing @echo off & SetLocal EnableDelayedExpansion & del "#pathlog.txt" & cd /d "#ppthapps\mencoder"
#newl#sing set maxw=480|#newl#sing set maxw=512|--Fallback width. There is no space at the end.--
#newl set audionew=-of lavf -oac lavc -lavcopts acodec=mp2:abitrate=128|#newl set audionew=-of lavf -oac lavc -lavcopts acodec=mp2:abitrate=64 -af channels=1|#newl set audionew=-oac twolame -twolameopts br=128|#newl set audionew=-oac mp3lame -lameopts cbr:br=128|#newl set audionew=-oac twolame -twolameopts br=64 -af channels=1|--Fallback audio codec--
#newl FOR /F "tokens=1,2 delims==" %%G IN ('mplayer.exe -identify -frames 0 -vo null -ao null  "#item" ') DO ( 
#newl IF %%G==ID_AUDIO_FORMAT IF %%H==85 (set encodemp3=-oac copy& set audio_codec=%%H) else (set encodemp3=!audionew!& set audio_codec=not_mp3) )
#newl if !ID_VIDEO_WIDTH! leq !maxw!  (set resizeline=) else (set resizeline=-vf scale -zoom -xy !maxw!)
#newl IF #exte==.flv (set encodemp3=!audionew!& set audio_codec=.flv, overriding, set to encode audio)
#newl echo old size="!ID_VIDEO_WIDTH!:!ID_VIDEO_HEIGHT!" new size="!maxw!:auto",  audio_codec="!audio_codec!" & echo *** resizeline="!resizeline!" encodemp3="!encodemp3!"
#newl "#ppthapps\mencoder\mencoder.exe" |--Path to file--
"#item" |--input file--
-ovc lavc -lavcopts vcodec=mpeg4:threads=2:vqscale=3.33 |-ovc lavc -lavcopts vcodec=mpeg4:threads=2:vbitrate=500 |-ovc lavc -lavcopts vcodec=mpeg4:threads=2:vbitrate=1000 |-ovc xvid -xvidencopts threads=2:bitrate=1000 |-ovc xvid -xvidencopts fixed_quant=3.33:threads=2 |-ovc xvid -xvidencopts pass=1:threads=2 |-ovc xvid -fixed_quant=3.33:threads=2:vhq=4 |--Video encoder--
!resizeline! |-vf scale -zoom -xy 512 |-vf scale -zoom -xy 480 |-vf scale=480:-3 |-vf scale=480:-2 |-resize, !! means use (resulting) variable-
#remark -scaling type-|-sws 0 |--scaling type--
!encodemp3! |-oac twolame -twolameopts br=128 |-oac twolame -twolameopts br=64 -af channels=1 |-oac mp3lame -lameopts cbr:br=128 |-of lavf -oac lavc -lavcopts acodec=mp2:abitrate=128 |-of lavf -oac lavc -lavcopts acodec=mp2:abitrate=64 -af channels=1 |-oac pcm |-oac copy |--audio encoder, !! means use (resulting) variable--
#remark -channels-|-af channels=1 |-af channels=2 |-channels-
-ffourcc XVID |-ffourcc DIVX |-ffourcc AVC1 |--Video tag. Use AVC1 for GoClever, instead of x264--
#remark -start time-|-ss 00:02:40 |-ss 49 |--Start time. Optional. HH:MM:SS--
#remark -end time-|-endpos 30 |-endpos 00:00:60 |--End time. Optional. Added to start time--
-o "#path#name-menc.avi" |--output file--
#remark -resample audio-|-af resample=44100 |-af resample=22050 |--resample audio--
#remark -set framerate-|-fps 25 |-fps 24 |-fps 23.97 |-fps 29.97 |-fps 30 |-fps 24000/1001 |--output fps--
#remark -aspect ratio-|-aspect 16:9 |-aspect 16:10 |-aspect 4:3 |--aspect ratio--
#remark -burn subtitle to file-|-sub "#path#name.srt" |-sub "#path#name.srt" -sid 999 |--burn subtitle to file, sid 999 to disable mkv subtitles--
#remark -subtitle encoding-|-subcp cp1250 |--subtitle encoding--
#remark -subtitle font size-|-subfont-text-scale 4.1 |--subtitle font size, default 4?--
#remark -move the subtitles up a bit-|-subpos 96 |--move the subtitles up a bit--
#newl set oldLength=!ID_LENGTH!
#newl FOR /F "tokens=1,2 delims==" %%G IN ('mplayer.exe -identify -frames 0 -vo null -ao null  "#path#name-menc.avi" ') DO ( set %%G=%%H)
#newl set newLength=!ID_LENGTH!& echo old length:!oldLength!, new length:!newLength!.
#newl IF !newLength!==!oldLength! (echo old length:!oldLength!, new length:!newLength! "#item" resizeline="!resizeline!" encodemp3="!encodemp3!" >> "#pathlog.txt") ELSE (echo WARNING: old length:!oldLength!, new length:!newLength! "#item" resizeline="!resizeline!" encodemp3="!encodemp3!">> "#pathlog.txt")





<comment>
Faster version of 1st preset with mencoder.
Width=480, and uses internal mp2 encoding. Check your file afterwards.
Resize width if greater than 480. If not in mp3, encode audio to mp2.
Log length of source and destination video.
To speed up encoding, you can set -scaling type- to sws 0, and channels to 1.
Sws 0 will blur picture up a bit.
For flv, you might need to encode audio, or use -fps. Use DO_INFO to find framerate.

-Use DO_INFO to find the frames per second (fps) of the flv video file. Look for "framerate" value.
-Use option "-fps 25 " to set output fps to a specific value.
-This can help if you get a lot of duplicate frames.

